import express from 'express';
import * as throwController from './throw.controller';
import { validateLoginData, authGuard, userGuard } from '../auth/auth.middleware';

const router = express.Router();

/**
 * 获取内容
 */
router.get('/throw', userGuard, throwController.index);

/**
 * 获取内容(按 ID)
 */
router.get('/throw/:postId', userGuard, throwController.throwDetail);

/**
 * 按关键字查询（模糊查询）
 */
router.get('/getThrowByKey', throwController.selectByKey);

/**
 * 创建内容
 */
router.post('/throw', authGuard, throwController.store);

/**
 * 更新内容
 */
router.patch('/throw/:postId', authGuard, throwController.update);

/**
 * 删除内容
 */
router.delete('/throw/:postId', authGuard, throwController.destroy);
router.post('/throwDestroy', authGuard, throwController.destroy);

/**
 * 修改状态
 */
router.patch('/throwStatus/:postId', authGuard, throwController.status);

/**
 * 导出路由
 */
export default router;
